<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h3>模板中使用函数</h3>
    <h4>{{ .Title }}</h4>
    <p>长度: {{ .Title | len }}</p>
    <p>长度: {{ len .Title }}</p>
    <p>时间：{{ .time | UnixToTime }}</p>
    <p>时间：{{ UnixToTime .time }}</p>

    <hr>
    <h3>空切片</h3>
    <ul>
        {{ range $key,$value := .EmptySlice }}
        <li>{{ $key }} - {{ $value }}</li>
        {{ else }}
        暂无数据
        {{ end }}
    </ul>

    <h3>只是获取值</h3>
    <ul>
        {{ range .Item  }}
        <li>{{ . }}</li>
        {{ end }}
    </ul>
    <hr>
    <h3>获取键值</h3>
    <ul>
        {{ range $key, $value := .Hobby }}
        <li>{{ $key }} - {{ $value }}</li>
        {{ end }}
    </ul>
    <table border="1" cellspacing="0" width="300">
        <tr>
            <th>编号</th>
            <th>标题</th>
            <th>发表时间</th>
        </tr>
        {{ range $key, $value := .News }}
        <tr>
            <td>{{ $value.Id }}</td>
            <td>{{ $value.Title }}</td>
            <td>{{ $value.Ctime }}</td>
        </tr>
        {{ end }}
    </table>
    
</body>
</html>